%macro get_f1099misc;

	
	proc printto log = "&logdir/get_f1099misc.txt" new;
	run;
	


		/****************************
		*	Get the tins 			*
		*	into 'tinlist'			*
		****************************/
		%make_tinlist;

		/****************************************
		*										*
		*			Start PROC SQL				*
		*										*
		****************************************/
		proc sql noprint;
		[connection details redacted]
			create table rlib.f1099misc as
			select * from connection to iq 
			(
			
			select
				sum(b.[redacted]) as nec,
				sum(b.[redacted]) as f1099misc_wh,
				a.person_id
			from #tinlist as a
				inner join [redacted] as b
					on(a.person_id = b.[redacted])
			where b.[redacted] = &base_yr
				and b.[redacted] <= 4
			group by a.person_id
			order by a.person_id
			);
			disconnect from iq;
			quit;



	proc printto;
	run;
%mend;
